package cn.hh.hrm.constant;

public enum GradeLevel {
    BRONZE(1,"青铜"),SILVER(2,"白银"),GOLD(3,"黄金"),PLATINUM(4,"铂金");
    private Integer id;
    private String name;

    GradeLevel(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public static GradeLevel checkGradeLevelById(Long id) {
        //获取枚举中所有列举的值
        GradeLevel[] levels = GradeLevel.values();
        for (GradeLevel level:levels) {
            //判断id和枚举的id是否相等
            if(level.id.longValue() == id){
                return  level;
            }
        }
        return null;

    }
}
